﻿using System.Collections.Generic;
using ShopB2C.Entity;

namespace ShopB2C.Interfaces
{
    public interface IUser
    {
        /// <summary>
        /// 获取用户地址簿
        /// </summary>
        /// <param name="uid">关联的用户ID</param>
        /// <returns>用户地址簿</returns>
        List<UserAddressEntity> AddressBookList(int uid);
        /// <summary>
        /// 保存地址簿
        /// </summary>
        /// <param name="user">关联的用户对象</param>
        /// <returns>当前被操作的地址ID,如果是新增地址则返回该地址的自增ID，如果是修改则是当前被操作的地址ID</returns>
        int SaveAddressBook(UserAddressEntity user);
        /// <summary>
        /// 删除收货人地址
        /// </summary>
        /// <param name="addressId">地址簿ID</param>
        /// <param name="uid">关联的用户ID</param>
        /// <returns>受影响的行</returns>
        int DeleteAddressBook(int addressId , int uid);
        /// <summary>
        /// 更新注册信息
        /// </summary>
        /// <param name="userInfo">包含用户信息的实体类</param>
        /// <returns>受影响的行</returns>
        int Update(UserEntity userInfo);
        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="uid">关联的用户ID</param>
        /// <param name="oldPassword">旧密码</param>
        /// <param name="newPassword">新密码</param>
        int ChangePassword(int uid , string oldPassword , string newPassword);
        /// <summary>
        /// 用户登录
        /// </summary>
        /// <param name="uname">用户名</param>
        /// <param name="password">密码</param>
        /// <returns>登陆后的用户资料</returns>
        UserEntity Login(string uname , string password);
        /// <summary>
        /// 注册新用户
        /// </summary>
        /// <param name="_user">关联的用户实体</param>
        /// <returns>新用户的用户ID</returns>
        int RegNewUser(UserEntity _user);
        /// <summary>
        /// 用户列表
        /// </summary>
        List<UserEntity> UserList(int pageSize , int pageIndex , ref int pageCount);
        /// <summary>
        /// 删除用户
        /// </summary>
        /// <param name="uid">用户编号</param>
        int DeleteUser(int uid);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="uid"></param>
        /// <returns></returns>
        UserEntity UserProfile(int uid = 0 , string uname = "" , string nickName = "");
        /// <summary>
        /// 
        /// </summary>
        /// <param name="uid"></param>
        /// <param name="enabled"></param>
        /// <param name="levelId"></param>
        int UpdateUserState(int uid = 0 , int enabled = 0 , int levelId = 0);
    }
}
